//
//  AddressCell.m
//  Zhiche-Carriage
//
//  Created by 王亚陆 on 16/6/15.
//  Copyright © 2016年 LeeBruce. All rights reserved.
//

#import "AddressCell1.h"
#import <Masonry.h>
@implementation AddressCell1

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        
        UIView * viewline = [[UIView alloc]init];
        viewline.backgroundColor = LineGrayColor;
        [self.contentView addSubview:viewline];
        [viewline mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.contentView.mas_top);
            make.left.mas_equalTo(self.contentView.mas_left);
            make.size.mas_equalTo(CGSizeMake(Main_Width, 0.5));
        }];
        UIView * viewSline = [[UIView alloc]init];
        viewSline.backgroundColor = LineGrayColor;
        [self.contentView addSubview:viewSline];
        
        
        _CityName = [self createUIlabel:@"" andFont:FontOfSize13 andColor:littleBlackColor];
        _address = [self createUIlabel:@"" andFont:FontOfSize13 andColor:littleBlackColor];
        _SmallImage = [[UIImageView alloc]init];
        [self.contentView addSubview:_CityName];
        [self.contentView addSubview:_address];
        [self.contentView addSubview:_SmallImage];
        [_CityName mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_SmallImage.mas_right).with.offset(16*kWidth);
            make.centerY.mas_equalTo(self.contentView.mas_top).with.offset(21.5*kHeight);
        }];
        [_address mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_SmallImage.mas_right).with.offset(16*kWidth);
            make.centerY.mas_equalTo(_CityName.mas_centerY).with.offset(21.5*kHeight);
        }];
        [_SmallImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).with.offset(20*kWidth);
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
            make.size.mas_equalTo(CGSizeMake(12*kWidth, 16*kHeight));
        }];
        
        [viewSline mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.CityName.mas_top);
            make.left.mas_equalTo(self.contentView.mas_left).with.offset(40*kWidth);
            make.width.mas_equalTo(0.5*kHeight);
            make.bottom.mas_equalTo(self.address.mas_bottom);
        }];
        

        
    }
    return self;
}

-(UILabel*)createUIlabel:(NSString *)title andFont:(CGFloat)font andColor:(UIColor*)color {
    UILabel * label =[[UILabel alloc]init];
    label.text = title;
    label.textColor = color;
    UIFont *fnt = [UIFont fontWithName:@"HelveticaNeue" size:font];CGSize size = [label.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:fnt,NSFontAttributeName, nil]];
    CGFloat nameH = size.height;
    CGFloat nameW = size.width;
    label.textAlignment = NSTextAlignmentLeft;
    label.frame =CGRectMake(0, 0, nameW, nameH);
    label.font = Font(font);
    return label;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
